<template>
	<!-- 数据 -->
	<view class="container">
		<view class="content_container">
			<image src="/static/images/list_bg@2x.png"></image>
			<view class="nav_content">	
				<!-- 内容区域 -->
				<view class="content">
					<!-- 内容1 -->
					<view class="list_Item" @tap="goPage('/pages/income/income')">
						<view class="content_list">
							<view class="list_header">
								<view class="header_details">
									<view class="header_text">查看详情</view>
								</view>
							</view>
							<view class="list_content">
								<view class="list_title">总收益(元)</view>
								<view class="list_number">{{profitAll}}</view>
							</view>
							<view class="list_foot">
								<view class="foot_box">
									<view class="list_title">今日收益(元)</view>
									<view class="list_number">{{profitToday}}</view>
								</view>
								<view class="foot_center"></view>
								<view class="foot_box">
									<view class="list_title">本月收益(元)</view>
									<view class="list_number">{{profitMonth}}</view>
								</view>
							</view>
						</view>
					</view>
					<!-- 内容3 -->
					<view class="list_Item" @tap="goPage('/pages/team/teamDetail')">
						<view class="content_list">
							<view class="list_header">
								<view class="header_details">
									<view class="header_text">查看详情</view>
								</view>
							</view>
							<view class="list_content">
								<view class="list_title">总人数(人)</view>
								<view class="list_number">{{teamAll}}</view>
							</view>
							<view class="list_foot">
								<view class="foot_box">
									<view class="list_title">今日新增(人)</view>
									<view class="list_number">{{teamToday}}</view>
								</view>
								<view class="foot_center"></view>
								<view class="foot_box">
									<view class="list_title">本月新增(人)</view>
									<view class="list_number">{{teamMonth}}</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	import {
		toLogin,
	} from '@/utils/login'
	import {
		homeTeam,
	} from '@/api/common.js'
	export default {
		data() {
			return {
				profitAll:'0.00',
				profitToday:'0.00',
				profitMonth:'0.00',
				teamAll:0,
				teamToday:0,
				teamMonth:0,
			}
		},
		onLoad() {
			this.getTeam()
		},
		onShow() {
			this.getTeam()
		},
		methods: {
			goPage(url) {
				if(!this.isLogin) return toLogin()
				uni.navigateTo({
					url
				});
			},
			getTeam(){
				homeTeam().then(res=>{
					if(res.code == 1){
						this.profitToday = res.data.today_sum;
						this.profitMonth = res.data.month_sum;
						this.profitAll = res.data.total_sum;
						this.teamToday = res.data.today_num;
						this.teamMonth = res.data.month_num;
						this.teamAll = res.data.total_num;
						
					}
				})
			}
		}
	}
</script>

<style>
	.container {
		width: 100%;
		/* #ifdef APP */
		padding-top: 100rpx;
		/* #endif */
	}
	
	.content_container {
		position: relative;
	}

	/* 导肮背景图 */
	.content_container image{
		width: 100%;
		height: 300rpx;
	}

	.nav_content {
		position: absolute;
		top: 120rpx;
		width: 100%;
	}

	.content {
		width: 95%;
		margin: 0 auto;
		padding-bottom: 220rpx;
	}

	.list_Item {
		position: relative;
		margin: 25rpx 0;
		width: 100%;
		height: 300rpx;
		border-radius: 16rpx;
	}

	.content_list {
		position: absolute;
		top: 0;
		width: 100%;
		height: 100%;
		background: #FFFFFF;
		border-radius: 10rpx;
		z-index: 10;
	}

	.list_header {
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}

	.header_details {
		width: 150rpx;
		height: 54rpx;
		background: #EA4445;
		border-radius: 0rpx 10rpx 0rpx 10rpx;
	}

	.header_text {
		margin: 0 auto;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		text-align: center;
		line-height: 54rpx;
	}

	.list_content {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin: 0 auto;
	}

	.list_title {
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		text-align: center;
		color: #1D1F24;
		line-height: 54rpx;
	}

	.list_number {
		font-size: 36rpx;
		text-align: center;
		font-family: PingFang SC;
		font-weight: bold;
		color: #1D1F24;
		line-height: 54rpx;
	}

	.list_foot {
		display: flex;
		justify-content: space-around;
		align-items: center;
	}
	.foot_box{
		width: 48%;
	}
	.foot_center {
		width: 1px;
		height: 54rpx;
		background: #1D1F24;
	}
</style>
